//
//  ViewController.m
//  Homework_11
//
//  Created by 徐昊 on 16/7/28.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ViewController.h"
#import "RrgisterViewController.h"
#import "FoundPasswordViewController.h"
@interface ViewController ()<UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UIView *backView;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    /** 贝塞尔曲线做圆角 */
//    UIBezierPath *maskPath5 = [UIBezierPath bezierPathWithRoundedRect:_backView.bounds byRoundingCorners:UIRectCornerBottomRight | UIRectCornerBottomLeft | UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(5, 5)];
//    CAShapeLayer *maskLayer5 = [[CAShapeLayer alloc] init];
//    maskLayer5.frame = _backView.bounds;
//    maskLayer5.path = maskPath5.CGPath;
//    _backView.layer.mask = maskLayer5;

}
- (void)textFieldDidBeginEditing:(UITextField *)textField {
    if (textField.tag == 1) {
        UIImageView *i = [self.view viewWithTag:10];
        [i setImage:[UIImage imageNamed:@"icon_username_select"]];
    }
    if (textField.tag == 2) {
        UIImageView *i = [self.view viewWithTag:20];
        [i setImage:[UIImage imageNamed:@"icon_password_select"]];
    }
}

- (void)textFieldDidEndEditing:(UITextField *)textField {
    if (textField.tag == 1) {
        UIImageView *i = [self.view viewWithTag:10];
        [i setImage:[UIImage imageNamed:@"icon_username"]];
    }
    if (textField.tag == 2) {
        UIImageView *i = [self.view viewWithTag:20];
        [i setImage:[UIImage imageNamed:@"icon_password"]];
    }
}
/** 点击回车收回键盘 */
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField endEditing:YES];
    return YES;
}

/** 点击屏幕收回键盘 */
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.view endEditing:YES];
}
- (IBAction)clickButton:(UIButton *)sender {
    RrgisterViewController *vc = [[RrgisterViewController alloc] init];
    [self presentViewController:vc animated:YES completion:^{
        
        
    }];
}
- (IBAction)forgetPassword:(id)sender {
    FoundPasswordViewController *vc = [[FoundPasswordViewController alloc] init];
    [self presentViewController:vc animated:YES completion:^{
        
        
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
